package com.orange.cetback.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.orange.cetback.pojo.entity.WritingCorrection;
import com.orange.cetback.mapper.WritingCorrectionMapper;
import com.orange.cetback.service.WritingCorrectionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 写作批改评价表 服务实现类
 * </p>
 *
 * @author chenenjun
 * @since 2025-03-06
 */
@Service
public class WritingCorrectionServiceImpl extends ServiceImpl<WritingCorrectionMapper, WritingCorrection> implements WritingCorrectionService {

    @Override
    public WritingCorrection getWritingCorrectionByRecordId(Long recordId) {
        LambdaQueryWrapper<WritingCorrection> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(WritingCorrection::getRecordId, recordId);
        if (this.baseMapper.selectOne(wrapper) != null) {
            return this.baseMapper.selectOne(wrapper);
        }
        return null;
    }
}
